package com.example.tliasfight.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

//@WebFilter(urlPatterns = "/*")
public class DemoFilter implements Filter{


    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
     //   Filter.super.init(filterConfig);
        System.out.println("init 初始化方法的调用");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.print("拦截到了请求");
        System.out.println("__放行前的逻辑");
        //放行请求
        filterChain.doFilter(servletRequest,servletResponse);

        System.out.println("放行后的逻辑");
    }

    @Override
    public void destroy() {
       // Filter.super.destroy();
        System.out.println("destory 销毁方法的调用");
    }
}
